<!doctype html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<iframe id="iframe-for-document.location"></iframe>
<iframe id="iframe-for-window.location"></iframe>
<script>
test(() => {
  let observation;
  (function() {
    let iframe = document.getElementById("iframe-for-document.location");
    let location = iframe.contentDocument.location;
    observation = internals.observeGC(location);
  })();
  gc();
  assert_false(observation.wasCollected, "Location wrapper object was collected.");
}, "document.location shouldn't be collected by GC.");

test(() => {
  let observation;
  (function() {
    let iframe = document.getElementById("iframe-for-window.location");
    let location = iframe.contentWindow.location;
    observation = internals.observeGC(location);
  })();
  gc();
  assert_false(observation.wasCollected, "Location wrapper object was collected.");
}, "window.location shouldn't be collected by GC.");
</script>
